from celery import Celery,platforms
from django.conf import settings
import os

#设置celery的默认工作目录
os.environ.setdefault("DJANGO_SETTINGS_MODULE","dailyfresh.settings")
#启动celery项目
app = Celery()
#项目加载配置
app.config_from_object("django.conf:settings")
#加载djcelery
app.autodiscover_tasks(lambda : settings.INSTALLED_APPS)
#支持以root启动
platforms.C_FORCE_ROOT = True